package cn.com.duiba.millionaire.center.biz.dao.impl;

import cn.com.duiba.millionaire.center.biz.constants.DatabaseSchema;
import cn.com.duiba.millionaire.center.biz.dao.BaseDao;
import cn.com.duiba.millionaire.center.biz.dao.MillionaireRenascenceRecordDao;
import cn.com.duiba.millionaire.center.biz.entity.MillionaireRenascenceRecordEntity;
import com.google.common.collect.Maps;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

/**
 * Created by sty on 1/18/18.
 */
@Repository
public class MillionaireRenascenceRecordDaoImpl extends BaseDao implements MillionaireRenascenceRecordDao {
    @Override
    public MillionaireRenascenceRecordEntity insert(MillionaireRenascenceRecordEntity millionaireRenascenceRecordEntity) {
        insert("insert",millionaireRenascenceRecordEntity);
        return millionaireRenascenceRecordEntity;
    }

    @Override
    public int updateById(MillionaireRenascenceRecordEntity millionaireRenascenceRecordEntity) {
        return update("updateById",millionaireRenascenceRecordEntity);
    }

    @Override
    public MillionaireRenascenceRecordEntity findById(Long id) {
        return selectOne("selectById",id);
    }

    @Override
    public int batchInsert(List<MillionaireRenascenceRecordEntity> records) {
        Map<String, Object> params = Maps.newHashMap();
        params.put("records", records);
        return update("batchInsert",params);
    }

    @Override
    protected DatabaseSchema chooseSchema() {
        return DatabaseSchema.MILLIONAIRE_CONFIG;
    }
}
